<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="/static/css/test.css" type="text/css" rel="stylesheet">
    <script src="webjars/jquery/3.5.1/jquery.js"></script>
    <script>
        $(function(){
            alert(1)
        })
    </script>
</head>
<body>
<p>hello222</p>
<p th:text="${session.username}"></p>
<form action="/login" method="post">
    用户名：<input type="text" name="username" placeholder="请输入用户名"/><br/>
    验证码：<input type="text" name="kaptcha"/><br/>
    <img onclick="getCode()" src="/captcha.jpg" alt="验证码未显示" title="验证码"/>
    <a href="javascript:getCode()">看不清</a><br/>
    <input type="submit" value="登录"/>
</form>
<script>
    // 获取动态验证码
    function getCode(){
            $("img").attr("src","/captcha.jpg?id="+new Date());// 客户端浏览器有缓存使用规则
    }
</script>
</body>
</html>
